﻿/*
	Copyright (C) 2019 Zongming Liu <1849059316@qq.com>

	This program is free software; you can redistribute it and/or modify
	it under the terms of the GNU General Public License as published by
	the Free Software Foundation; either version 2 of the License, or
	(at your option) any later version.
	
	This program is distributed in the hope that it will be useful,
	but WITHOUT ANY WARRANTY; without even the implied warranty of
	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
	GNU General Public License for more details.
	
	You should have received a copy of the GNU General Public License along
	with this program; if not, write to the Free Software Foundation, Inc.,
	51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/

#ifndef EventMouse_h__
#define EventMouse_h__

#include "InputEvent.h"

namespace SkyEngine2d
{
	//! 鼠标事件 
	class EventMouse
		:public InputEvent
	{
	public:
		
		//! 鼠标事件类型
		enum class MouseEventType
		{
			None,/*!< 空类型. */
			Down,/*!< 鼠标键按下. */
			Up,	 /*!< 鼠标键弹起. */
			Move,/*!< 鼠标移动. */
			Scroll,/*!< 鼠标滚轮转动. */
			DoubleDown,/*!< 双击按下. */
		};
	
		//! 鼠标按键类型 
		enum class ButtonType
		{
			None = -1,
			Left = 0,
			Right = 1,
			Middle = 2,
		};
	
	public:
	
		//! 构造一个鼠标事件实例
		/*!
		\param MouseEventType type  鼠标事件的类型 
		\sa ~EventMouse()
		*/
		EventMouse(MouseEventType type,ButtonType button=ButtonType::None);
	
		//! 析构器
		/*!
		\sa EventMouse()
		*/
		~EventMouse();
	
		//! 获取鼠标事件的类型
		/*!
		\return EventMouse::MouseEventType 返回鼠标事件的类型
		*/
		MouseEventType getMouseEventType()const;
	
		void setCurrentPos(float x, float y);
	
		void reset(MouseEventType type,float x,float y, ButtonType button = ButtonType::None);
	
		float getCurrentPosX()const;
		float getCurrentPosY()const;
	
		const ButtonType & getButton()const { return m_mouseButton; }
	private:
	
		MouseEventType m_mouseEventType;
		ButtonType     m_mouseButton;
		float			m_x;
		float			m_y;
	
	};
}

#endif // EventMouse_h__
